import java.util.Arrays;
import java.util.Scanner;

abstract class Shape{
	final double PI=3.14;
	
	public abstract double getPerimeter();
	public abstract double getArea();
	public static double sumAllArea(Shape s[]){
		double sum=0;
		for (int i = 0; i < s.length; i++) {
			sum+=s[i].getArea();
		}
		return sum;
	}
	public static double sumAllPerimeter(Shape s[]){
		double sum=0;
		for (int i = 0; i < s.length; i++) {
			sum+=s[i].getPerimeter();
		}
		return sum;
	}
}
class Rectangle extends Shape{
	private int width;
	private int length;
	Rectangle(int width,int length){
		this.width=width;
		this.length=length;
	}
	public double getPerimeter(){
		return (width+length)*2;
	}
	public double getArea(){
		return width*length;
	}
	@Override
	public String toString() {
		return "Rectangle [width=" + width + ", length=" + length + "]";
	}
	
}
class Circle extends Shape{
	private int radius;
	 Circle(int radius){
		 this.radius=radius;
	 }
	public double getPerimeter(){
		return (radius*2*PI);
	}
	public double getArea(){
		return (radius*radius*PI);
}
	@Override
	public String toString() {
		return "Circle [radius=" + radius + "]";
	}
}


public class Sy41 {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		Shape[] s=new Shape[n];
		for(int i=0;i<n;i++){
			String str=new String(input.next());
			if(str.equals("rect")){
				Shape r=new Rectangle(input.nextInt(), input.nextInt());
				s[i]=r;
			}
			if(str.equals("cir")){
				Shape c=new Circle(input.nextInt());
				s[i]=c;
			}
		}
		System.out.println(Shape.sumAllPerimeter(s));
		System.out.println(Shape.sumAllArea(s));
		System.out.println(Arrays.deepToString(s));
		for (int i=0;i<s.length;i++) {
			System.out.println(s[i].getClass()+","+s[i].getClass().getSuperclass());
		}

	}

}
